package com.dhnsoft.代码随想录.双指针法;

/**
 * ClassName: d01_27_移除元素
 * Package: com.dhnsoft.代码随想录.双指针法
 * Description:
 *
 * @Author dhn
 * @Create 2024/3/20 11:15
 * @Version 1.0
 */
public class d01_27_移除元素 {

    public int removeElement(int[] nums, int val) {
        int fast,slow;
        for (fast=0,slow=0;fast<nums.length;fast++){
            if(nums[fast]!=val){
                nums[slow++]=nums[fast];
            }
        }
        return slow;
    }
}
